package com.example.voting_master.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.voting_master.entity.VoteTheme;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface VoteThemeMapper extends BaseMapper<VoteTheme> {

    @Results({@Result(column = "id",property = "id"),
            @Result(column = "id",property = "candidates",many = @Many(select = "com.example.voting_master.mapper.CandidateMapper.selectByThemeId"))})
    @Select("SELECT * From vote_theme")
    List<VoteTheme> selectVoteThemeWithCandidates();
}
